//
//  CellOfCellOfHot_area.m
//  FreeTravel
//
//  Created by 徐康 on 16/9/8.
//  Copyright © 2016年 KX. All rights reserved.
#import "FreeTravelMacro.h"
#import "UIImageView+WebCache.h"
#import "Masonry.h"
#import "CellOfCellOfHot_area.h"
@interface CellOfCellOfHot_area ()
@property (nonatomic, strong) UIImageView *imageViewOfPhoto;
@property (nonatomic, strong) UILabel *labelOfTitle;
@property (nonatomic, strong) UILabel *labelOfPrice;
@property (nonatomic, strong) UILabel *labelOfSold;
@end
@implementation CellOfCellOfHot_area
- (instancetype)initWithFrame:(CGRect)frame{
    self = [super initWithFrame:frame];
    if (self) {
        self.imageViewOfPhoto = [[UIImageView alloc]init];
        self.labelOfSold = [[UILabel alloc]init];
        self.labelOfPrice = [[UILabel alloc]init];
        self.labelOfTitle = [[UILabel alloc]init];
        [self.contentView addSubview:self.labelOfTitle];
        [self.contentView addSubview:self.labelOfPrice];
        [self.contentView addSubview:self.labelOfSold];
        [self.contentView addSubview:self.imageViewOfPhoto];
    }
    return self;
}
- (void)layoutSubviews{
    [super layoutSubviews];
    [self.imageViewOfPhoto mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.left.bottom.equalTo(self.contentView);
        make.width.mas_offset((SCREEN_WIDTH-50)/4);
    }];
    [self.labelOfTitle mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView.mas_top).mas_offset(10);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-10);
        make.left.equalTo(self.imageViewOfPhoto.mas_right).mas_offset(10);
        make.bottom.equalTo(self.contentView.mas_centerY);
        
    }];
    [self.labelOfSold mas_makeConstraints:^(MASConstraintMaker *make) {
        make.left.equalTo(self.imageViewOfPhoto.mas_right).mas_offset(10);
        make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-10);
        
    }];
    [self.labelOfPrice mas_makeConstraints:^(MASConstraintMaker *make) {
        make.bottom.equalTo(self.contentView.mas_bottom).mas_offset(-10);
        make.right.equalTo(self.contentView.mas_right).mas_offset(-10);
    }];
}
- (void)setModel:(ModelOfHot_areaList *)model{
    _model = model;
    [self.imageViewOfPhoto sd_setImageWithURL:[NSURL URLWithString:model.photo]];
    self.labelOfPrice.text = model.price;
    self.labelOfSold.text = model.sold;
    self.labelOfTitle.text = model.title;
}
- (void)setSecondModel:(ModelOfDiscount_topicList *)secondModel{
    _secondModel = secondModel;
    [self.imageViewOfPhoto sd_setImageWithURL:[NSURL URLWithString:_secondModel.photo]];
    self.labelOfPrice.text = secondModel.price;
    self.labelOfSold.text = secondModel.sold;
    self.labelOfTitle.text = secondModel.title;
    
}
@end
